package com.library.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.library.bean.Book;
import com.library.bean.Page;
import com.library.service.BookService;
import com.library.service.impl.BookServiceImpl;


@WebServlet("/getAllBooks.do")
public class GetBookServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int pageNum = Integer.parseInt(request.getParameter("pageNum"));
		int pageSize = Integer.parseInt(request.getParameter("pageSize"));
		BookService bs = new BookServiceImpl();
		Page<Book> page = bs.getAllBook(pageNum, pageSize);
		request.setAttribute("page", page);
		request.getRequestDispatcher("success.jsp").forward(request,response);
	}
	
	

}
